#ifndef		_HEURISTIC_H_
#define		_HEURISTIC_H_

#include "Board.h"
#include "Gomoku.h"

// ---------- POSITIONS CORDINATES POSITIONS DATA STRUCTURE -----------------------
struct					Move
{
public:
	Move();
	Move(unsigned short x, unsigned short y);
	~Move();
	Move(const Move &);
	Move	&			operator=(const Move &);

public:
	void				GetCoordinates(unsigned short & x, unsigned short & y);
	void				SetCoordinates(unsigned short & x, unsigned short & y);

public:
	unsigned short		_x;
	unsigned short		_y;
};

// --------------------- HEURISTIC CLASS DECLARATION ------------------------------
class				Heuristic
{
public:
	Heuristic();
	~Heuristic();

private:
	Heuristic(const Heuristic &);
	Heuristic	&		operator=(const Heuristic &);

private:
	const char		Ctrl(const unsigned short x, const unsigned short y);
	void			SetAdvColor(const char color);
	void			InitContext(Board* cases, const Move & move, const char color);

private:
	void			OneThreatSearch();
	void			TwoBlockThreatSearch();
	void			TwoFreeThreatSearch();
	void			TwoOpenThreatSearch();
	void			ThreeOpenThreatSearch();
	void			ThreeOpenBlockSideOneThreatSearch();
	void			ThreeOpenBlockSideTwoThreatSearch();
	void			ThreeBlockThreatSearch();
	void			ThreeFreeThreatSearch();
	void			FourBlockThreatSearch();
	void			FourFreeThreatSearch();
	
private:
	bool			LookVertically();
	bool			LookHorizontally();
	bool			LookOnDiagonalLeft();
	bool			LookOnDiagonalRight();
	void			HuntFourAlignedPieces();

public:
	const int		GetMoveValue(Board* cases, const Move & move, const char _color);

private:
	Board	*		_cases;
	int				_moveCost;
	Move			_moveCoordinates;
	char			_color;
	char			_advcolor;
	char			_nonecolor;
};

	// -------------------- METHODS POINTER DECLARATION -------------------------------

typedef void (Heuristic::*MethodPtr)();
typedef bool (Heuristic::*MethodPtr2)();

struct			Tab
{
	MethodPtr	M_Ptr;
};

struct			Tab2
{
	MethodPtr2	M_Ptr2;
};

#endif		//_HEURISTIC_H_